/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.alxbrendmaquinarias.service;

import com.alxbrendmaquinarias.model.StorehouseProduct;
import com.alxbrendmaquinarias.repository.GenericDAO;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author Max
 */
@Service
public class StorehouseProductServiceImpl implements StorehouseProductService {

    @Autowired
    GenericDAO genericDAO;

    @Override
    public List list(String namedQuery, Map<String, Object> parameters) throws Exception {
        return genericDAO.findWithNamedQuery(namedQuery, parameters);
    }

    @Override
    public Integer count(String namedQuery, Map<String, Object> map) throws Exception {
        return (Integer) genericDAO.count(namedQuery, map);
    }

    @Override
    public List listLazy(String queryName, Map<String, Object> parameters, int start, int finish) {
        return genericDAO.findWithNamedQueryLazyLoading(queryName, parameters, start, finish);
    }

    @Override
    public void update(StorehouseProduct storehouseProduct) throws Exception {
        genericDAO.update(storehouseProduct);
    }

    @Override
    public StorehouseProduct create(StorehouseProduct storehouseProduct) throws Exception {
        return genericDAO.create(storehouseProduct);
    }

    @Override
    public void update(String sql, boolean isNative) throws Exception {
        genericDAO.update(sql, isNative);
    }

}
